import Vue from 'vue'
import Vuex from 'vuex'
import axios from 'axios'

Vue.use(Vuex)

const store = new Vuex.Store({
	state:{
		article_detail: null
	},
	mutations:{
		ArticleDetail(state,data){
			state.article_detail = data;
		}
		
	},
	actions:{
		getArticleDetail(store, id){
			console.log("id:",id);
			axios({
				url: `http://127.0.0.1:8006/article/list/${id}`
			})
			.then(res=>{
				console.log(res.data);
				store.commit("ArticleDetail",res.data);
			})
		}
	}
})


export default store
